home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
cmln1085.arc
/
FIGURES.HDC
< prev
next >
Wrap
Text File
|
1986-02-27
|
7KB
|
181 lines
@style{topmargin 2 lines, bottommargin 2 line, leftmargin 1 char,
rightmargin 1 char, linewidth 79 chars}
Figure 1. GSX CALL AND RETURN. The graphics program calls GSX
and sends the location of some graphics data to be processed;
GIOS displays it and returns, possibly with some data and status
information.
@newpage
Figure 2. An example of POLYLINE with 4 points: (3,-1), (2,4),
(-1,0), (2,3), joined in sequence.
@newpage
Figure 3. The window parameter block contains the pointers to
the five arrays required by GSX: CONTRL, INTIN, PTSIN, INTOUT,
and PTSOUT. Note that CONTRL contains size information for each
of the other four arrays along with the GSX function code. In
particular, for the PTSIN and PTSOUT arrays, this size
information describes @I{the number of points in the array},
namely n@-{ic} and n@-{oc}, which is one-half the number of
coordinates given in each of the respective arrays.
@newpage
Figure 4. THE MACHINE CODE INTERFACE TO GSX. The interface
requires the use of the Turbo-supplied procedure INLINE which
permits hex machine code to be inserted directly into the Pascal
source code. INLINE is incorporated into the procedure CALLGDOS
which receives a pointer to the window parameter block. The
Turbo function ADDR() returns an address of its argument which is
compatible with an integer pointer (^integer).
@begin{verbatim}
TYPE pinteger : ^INTEGER; {global declaration}
:
:
PROCEDURE callgdos (ppb : pinteger);
{**************************************************
* ppb is a pointer to the window parameter block. *
* The procedure takes this pointer and performs *
* the software interrupt 224 for the 8086 CPU. *
**************************************************}
BEGIN
INLINE(
$52/ {PUSH DX }
$51/ {PUSH CX }
$B9/$73/$04/ {MOVE CX, 473H }
$8B/$56/$04/ {MOVE DX, 04[BP] }
$CD/$E0/ {INT 224 }
$59/ {POP CX }
$5A {POP DX })
END;
A call to CALLGDOS would take the form
callgdos( ADDR( parameter_block_array )).
@END{VERBATIM}
@newpage
Figure 5. SET THE PARAMETER BLOCK. The procedure SETPBLOCK is
provided to assist with setting the parameter block for the
specific GSX function calls.
@BEGIN[VERBATIM]
TYPE pinteger : ^INTEGER; { global }
VAR pb : ARRAY[1..5] OF pinteger; {declarations}
:
:
PROCEDURE setpblock( c, in, pin, out, pout : pinteger );
{****************************************************
* c . . . contrl array address *
* in . . . input parameter array address *
* pin . . . input points array address *
* out . . . output parameter array address *
* pout . . . output points array address *
****************************************************}
BEGIN pb[1] := c; pb[2] := in;
pb[3] := pin; pb[4] := out;
pb[5] := pout
END;
A call to SETPBLOCK would take the form
setpblock( ADDR(CONTRL), ADDR(INTIN),
ADDR(PTSIN ), ADDR(INTOUT),
ADDR(PTSOUT))
@END{VERBATIM}
@newpage
Figure 6. POLYLINE AND INPUTLOCATOR PROCEDURES.
@begin{verbatim}
(a) POLYLINE is used to draw a sequence of lines defined by any
array of points of given length.
{***********************************************************************}
PROCEDURE polyline( npts : INTEGER; {in: no. of coordinate pairs}
ptsin : pinteger ); {in: pointer to points array}
{***********************************************************************}
@i[{Array must be loaded with npts coordinate pairs in the form xyxyxyxy.
Pass the ADDR(first element of the array) as the second argument above }]
VAR contrl : ARRAY[1..5] OF INTEGER;
intin, intout, ptsout : INTEGER;
BEGIN contrl[1]:= 6; contrl[2]:= npts; contrl[4]:= 0;
setpblock( addr(contrl), addr( intin), ptsin,
addr(intout), addr(ptsout));
callgdos( addr(pb))
END;
(b) INPUTLOCATOR permits positioning or sampling a graphics input
locating device.
{***********************************************************************}
FUNCTION inputlocator( device, {in: device number for input}
mode, {in: 1=request, 2=sample }
x, y : INTEGER; {in: initial coords of locator
(request mode only,
ignored if sample mode)}
VAR finalx, finaly : INTEGER; {out: final coords of locator}
VAR terminator : CHAR {out: terminator character }
): INTEGER; {out: 0 = not successful
>0 = successful }
{***********************************************************************}
VAR contrl : ARRAY[1..5] OF INTEGER;
ptsin, ptsout : ARRAY[1..2] OF INTEGER;
intin, intout : INTEGER;
BEGIN contrl[1] := 28;
IF mode = 2 THEN contrl[2] := 0 ELSE contrl[2] := 1;
contrl[4] := 1;
intin := device;
IF contrl[2] = 1 THEN BEGIN
ptsin[1] := x;
ptsin[2] := y
END {IF};
setpblock( ADDR(contrl), ADDR( intin), ADDR(ptsin ),
ADDR(intout), ADDR(ptsout));
callgdos( ADDR(pb));
inputlocator := contrl[5];
finalx := ptsout[1];
finaly := ptsout[2];
terminator := CHR(intout)
END;
@end{verbatim}
@NEWPAGE
Figure 7. ESCAPE FUNCTION EXAMPLE. Since most escape functions
differ only in the value assigned to the CONTRL array, the
utility procedure ANSCTL assigns the proper values and calls
CALLGDOS and SETPBLOCK. Therefore, the calls in the Pascal
source code for most escape functions consists of one line, e.g.
ANSCTL(5,0,0,2) when ENTERGRAPHICS is called.
@begin{verbatim}
{*******************************************************************}
PROCEDURE ansctl(a, b, c, d : INTEGER);
{*******************************************************************}
@I[{Utility to assign CONTRL values to elements 1,2,4, and 6, then
SETPBLOCK, and CALLGDOS.}]
VAR contrl : ARRAY[1..6] OF INTEGER;
intin, intout, ptsin, ptsout : INTEGER;
BEGIN contrl[1] := a; contrl[2] := b; contrl[4] := c;
contrl[6] := d;
setpblock( ADDR(contrl), ADDR( intin),
ADDR(ptsin ), ADDR(intout),
ADDR(ptsout));
callgdos( ADDR(pb))
END;
{*******************************************************************}
PROCEDURE entergraphics;
{*******************************************************************}
@i[{Device enters graphics mode from alpha cursor mode}]
BEGIN ansctl(5,0,0,2) END;
@END{VERBATIM}
the calls in the Pascal
sourc